home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
tpio24.zip
/
IO24DEMO.DOC
< prev
next >
Wrap
Text File
|
1993-01-04
|
4KB
|
77 lines
DOCUMENTATION FOR IO24DEMO, IO24, DATE24 -- 8/22/89
Bill Meacham
1004 Elm Street
Austin, Tx 78703
PUBLIC DOMAIN -- NO COPYRIGHT
The program IO24DEMO demonstrates a sophisticated method of controlling
console data entry in Turbo Pascal version 4.0 and above. It allows you
precise control over where data entry occurs on the screen and makes your
programs crash-proof from user input. This is version 2.4. I translated
version 2.2 to Turbo Pascal version 4.0 and then recompiled under 5.0. It
should work under 5.5 as well. I fixed a couple of obscure bugs in the
process. Version 2.2 is described in detail in Computer Language magazine,
October 1987, page 57, "Build Your Own User Interface." Version 2.4 works
just the same, so see the article for more information.
All the I/O (input/output) routines except for dates are in the source file
IO24.PAS. Compile this to create a linkable Unit.
The program also demonstrates a number of ways to manipulate and perform
calculations with dates. All the date routines are in the file DATE24.PAS.
If you Use this file, you must Use IO24 first.
Put the compiler toggle {$V-} at the top of your program; this allows you
to use strings of varying lengths. Put the command "checkbreak := false"
in the code before you read anything from the console; this disables
checking for control-break and prevents the user from breaking out of the
program.
If you have Fansi-Console or a similar video display speed-up utility
installed in your computer it will interfere with Turbo Pascal 4.0 and
above's direct video screen writes. The solution is to either (a) remove
the video speed-up utility before running your Turbo 4.0 and above program
or (b) put the command "directvideo := false" at the beginning of your
program. If you do (b) Turbo uses ROM BIOS calls to display things on the
screen instead of writing directly to video RAM. Screen displays are then
slower, about as fast as in Turbo 3.0, but are not glitched by the video
speed-up utility.
The rest of this document describes the Unit files.
IO24.PAS ------------------------------------------------------------------
The functions and procedures in this Unit allow you to control console I/O
with great precision. You can read and write strings, integers, reals and
booleans at any place on the screen and prevent the user from entering
garbage. User input cannot crash your program! You can easily control
cursor movement through data entry forms displayed on the screen, not only
from field to field but from screen to screen.
The data input procedures, READ_STR, READ_INT, etc., have an intentional
side-effect on the global variable FLD, which controls which field the
cursor goes to. Study the code in procedures STRINGS, INTEGERS, REALS and
BOOLEANS in the demonstration program to see how a case statement within a
repeat-until loop uses this variable. Study the code in procedure IO_DEMO
in the demonstration program to see how a similar case statement within a
repeat-until loop uses the global variable SCRN to control which screen is
displayed.
The Interface section describes the global types, variables, procedures
and functions that you can call from your program. (There are a few more
that are used by these procedures and functions, but are not intended to be
called by themselves.)
DATE24.PAS ----------------------------------------------------------------
The functions and procedures in this Unit allow you to read and write
dates in a fashion similar to reading and writing strings, integers, reals
and booleans. You can also perform number of other functions on dates,
such as count the number of days between two dates, test for leapyear,
compute the previous and next day, etc. To Use this unit you must first
Use IO24.